import java.util.Locale;

//判断一个字符串是否为回文
public class isHuiWen {
public boolean ispalindrome(String s){
    s=s.toLowerCase();//全都转为小写；
    //Character.isDefined()判断是否为数字
    //Character.isLetter()判断是否为小写字母
    int left = 0;
    int right= s.length()-1;
    while(left<right){
        while(!isvalidchar(s.charAt(left))){
            left++;
        }
        while(!isvalidchar(s.charAt(right))){
            right--;
        }
        if(s.charAt(left)!=s.charAt(right)){
            return false;
        }else{
            left++;
            right--;
        }
    }
    return true;
}
private boolean isvalidchar(char ch){

    if(ch>='0'&&ch<='9'||ch>='a'&&ch<='z'){
        return true;
    }
    return false;
}
}
